package com.ruoyi.web.controller.api;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.controller.api.service.ApiService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : tianyu
 * @date : 2025-01-11 14:56
 * @Version: 1.0
 * @Desc : AI模型后端接口
 */

@RestController
@RequestMapping("/aiApi")
public class KnowledgeBaseApiController{

    @Autowired
    private ApiService apiService;
    /**
     * @author : tianyu
     * @date : 2025-01-11 14:56
     * @Version: 1.0
     * @Desc : url来源于部署的AI模型后端接口 payload的query字段第一次来源于前端的输入，
     * 后续的query字段来源于response的answer字段
     * @return
     */
    @SneakyThrows
    @PostMapping("/callExternalApi")
    public AjaxResult getAiContent(@RequestParam("query") String query) {
        return apiService.callExternalApi(query);
    }


}
